import 'package:XinXiZiXun/common/utils/utils.dart';
import 'package:XinXiZiXun/common/values/values.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///欢迎页
class WelcomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 此处假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334)
    ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: true);

    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Stack(
              alignment: AlignmentDirectional.center,
              children: [
                Container(
                  width: duSetWidth(320),
                  height: duSetHeight(320),
                  child: Image.asset(
                    "assets/images/ic_kaiping.png",
                    fit: BoxFit.none,
                  ),
                ),
                Container(
                  alignment: Alignment.center,
                  width: duSetWidth(120),
                  height: duSetWidth(120),
                  decoration: BoxDecoration(
                    color: Color.fromARGB(255, 226, 117, 70),
                    borderRadius: BorderRadius.all(Radius.circular(6.0)),
                  ),
//                  color: Color.fromARGB(255, 226, 117, 70),
                  child: Text(
                    "Logo",
                    style: TextStyle(
                      fontFamily: "Montserrat",
                      fontSize: duSetScaleFontSize(30.0),
                      fontWeight: FontWeight.w600,
                      color: AppColors.primaryBackgroundColor,
                    ),
                    textAlign: TextAlign.center,
                  ),
                )
              ],
            ),
            SizedBox(
              height: duSetHeight(20.0),
            ),
            Text(
              "不易积硅步无以至千里",
              style: TextStyle(
                fontFamily: "Montserrat",
                fontSize: duSetScaleFontSize(32.0),
                fontWeight: FontWeight.w600,
                color: AppColors.primaryBlackColor,
              ),
            ),
            SizedBox(
              height: duSetHeight(100),
            ),
            Container(
              width: duSetWidth(400),
              height: duSetHeight(60),
//              color: AppColors.primaryElementColor,
              child: FlatButton(
                color: AppColors.primaryDarkGrayColor,
                textColor: AppColors.primaryBackgroundColor,
                child: Text(
                  "Get Start",
                ),
                shape: StadiumBorder(),
                onPressed: () {
                  //跳转其他页面不返回(从路由栈中移除本页面)
                  //1.代替
                  Navigator.of(context).pushReplacementNamed('/tabbar');

                  //2。移除之前的路由
//                  Navigator.of(context).pushNamedAndRemoveUntil('/tabbar', (route) => false);

                  //弹出路由，跳转到其他页面
//                  Navigator.of(context).pushNamed('/tabbar');

                  //最基本系统自带跳转路由
//                  Navigator.push(context, MaterialPageRoute(builder: (context) => ZdyTabBarPage()));
                },
              ),
            )
          ],
        ),
      ),
    );
  }
}
